<#assign webroot=request.getContextPath()>
<#import "../../common/main.ftl" as main/>
<#assign menu_index=0 in main>
<#assign menu_index_sub=2 in main>
<@main.layout myTemplate=books/>
<#macro books>
<script>
	$(function(){
		$.get(
			"${webroot}/data_mgr/import_history/toimporthistory",
			function(data){
				$("#switch_area_import").html(data);
			}
		);
	
		
		$("#tab_import_history").bind("click",function(){
			$.get(
				"${webroot}/data_mgr/import_history/toimporthistory",
				function(data){
					$("#switch_area_import").html(data);
				}
			);
		});
		
		$("#tab_switch_clazz").bind("click",function(){
			$.get(
				"${webroot}/data_mgr/import_history/toswitchclazz",
				function(data){
					$("#switch_area_import").html(data);
				}
			);
		});
 	});
 	function check_date_input(){
 		$("#date_err").html("");
		var d1=$("#beginDate").val();
		var d2=$("#endDate").val();
		d1Arr=d1.split('-');
		d2Arr=d2.split('-');
		v1=new Date(d1Arr[0],d1Arr[1],d1Arr[2]);
		v2=new Date(d2Arr[0],d2Arr[1],d2Arr[2]);
		if(v1-v2>0){
			$("#date_err").html("查询日期设置有误");
			$("#result_tb").html("");
			return false;
		}
		return true;
	}
 	function qRecords(){
 		if(!check_date_input()){
 			return;
 		}
 		$(".loading").show();
 		$.post(
			"${webroot}/data_mgr/import_history/records",
			$("#import_history_form").serialize(),
			function(data){
				$("#result_tb").html(data);
				$(".loading").hide();
			}
		);
 	}
 	
 
</script>
<h1><span class="lf">数据管理>>图片管理</span>
	<#-- 	<a href="#" class="rt">返回</a> -->
</h1>
<div class="user">
	<div class="admin_box">
		<div class="admin_top1">
			<ul class="tab">
				<li class="active"><a href="javascript:;" id="tab_import_history">图片列表</a></li>
				<li class="nor"><a href="javascript:;" id="tab_switch_clazz">批量导入</a></li>
			</ul>
		</div>
		<div class="clear"></div>
		<div id="switch_area_import">
		  <table class="tb_style" >
    <colgroup>
    	<col width="20%" />
    	<col width="15%" />
    	<col width="15%" />
    	<col width="10%" />
    	<col width="10%" />
    	<col width="10%" />
    	<col width="20%" />
    </colgroup>
	<tr>
		<th>标题</th>
		<th>作者</th>
		<th>类型</th>
		<th>阅读数</th>
		<th>下载数</th>
		<th>积分</th>
		<th>操作</th>
	</tr>
	<#if (image_list?size >0)>
	 <#list image_list as book>
	<tr>
		 <td>${book.title}</td>
		 <td>${book.user.nickname}</td>
	     <td>${book.category.name}</td>
		 <td>${book.readCount?c} </td>
		 <td>${book.downloadCount?c} </td>
		 <td>${book.payment?c}</td>
		<td>
				<a href="javascript:;" >
					<img src="${webroot}/resources/images/yonghu.png" />
				</a>
		</td>
	</tr>
	</#list>
	<#else>
	<tr>
		<td colspan="7">未查询到数据</td>
	</tr>
	</#if>
</table>
<div class="clear"></div>
  <div class="tc_bt_box">${page.html}</div>
      <div class="tc_bt_box">
        <input type="button" value="新增" class="queding" onclick="javascript:window.location.href='${webroot}/data_mgr/image/new'"/>
        </div>
		</div>
	</div>
</div>
</#macro>